10 REM
20 REM-----------------------------------------
30 REM PRINT ANY TEXT FILE
40 REM
42 DEFINT A-Z
44 FALSE = 0: TRUE = NOT FALSE
50 PRTLEN = 80  ' LENGTH OF PRINT LINE
60 PRTMAX = 55  ' NO LINES / PAGE
70 PRTCTRL$ = ""    ' PRINTER FORMAT CTRL CHAR
80 ENDCTRL$ = ""   'END OF PRT LINE CTRL CHAR
90 CLS
94 KEY OFF
96 DRIVEB = FALSE: INFILE$ = ""
98 PRTPAUSE = FALSE: DSKPRINTER = FALSE: SKIP = FALSE
100 LOCATE 5,1,0
120 PRINT "DISPLAY/PRINT ANY TEXT FILE": PRINT: PRINT
140 PRINT
150 PRINT "ENTER THE NAME OF THE FILE, OR"
160 PRINT "ENTER `FILES' (ENTER) FOR DIRECTORIES"
170 PRINT:PRINT "PRESS (ESC) ANYTIME TO END OUTPUT"
180 PRINT
190  INPUT INFILE$
200 IF INFILE$ = "" THEN GOTO 90
220 IF (INFILE$ = "FILES") OR (INFILE$ = "files") THEN FILES : IF DRIVEB = TRUE THEN PRINT: FILES "B:*.*": PRINT: GOTO 140 ELSE GOTO 140
230 PRINT: PRINT "PRINT THE FILE ALSO? (Y OR N) "
240 A$ = INPUT$(1)
250 IF (A$ = "Y") OR (A$ = "y") THEN DSKPRINTER = TRUE ELSE DSKPRINTER = FALSE
260 PRINT:PRINT "PRINTER PAGE OVERFLOW CTRL? (Y OR N)  "
270 A$ = INPUT$(1)
280 IF A$ = "Y" OR A$ = "y" THEN SKIP = TRUE ELSE SKIP = FALSE
290 PRINT: PRINT "PAUSE WHEN SCREEN FULL? (Y OR N) "
300 A$ = INPUT$(1)
310 IF (A$ = "Y") OR (A$ = "y") THEN PRTPAUSE = TRUE ELSE PRTPAUSE = FALSE
320 REM
330 ON ERROR GOTO 630
340 NODISPLINES = 0: NOPRTLINES = 0
350 OPEN INFILE$ FOR INPUT AS #2
360 CLS
370 WHILE NOT EOF(2)
380 A$ = INKEY$: IF A$ = CHR$(27) GOTO 500
390 NODISPLINES = NODISPLINES + 1
400 NOPRTLINES = NOPRTLINES + 1
410 IF NODISPLINES = 24 THEN GOSUB 720  'DISP FULL
420 IF NOPRTLINES = PRTMAX THEN GOSUB 670  'PAGE FULL
430 LINE INPUT#2, L$
440 FOR I = 1 TO LEN(L$)
450 IF MID$(L$,I,1) = CHR$(10) THEN MID$(L$,I,1) = CHR$(0)
460 NEXT I
470 PRINT L$
480 IF DSKPRINTER = TRUE THEN LPRINT PRTCTRL$ + L$ + ENDCTRL$:
490 WEND
500 ' END OF INPUT FILE
590 PRINT: PRINT:PRINT "END OF FILE": PRINT"PRESS (ESC) IF DONE, OR": PRINT "ANY OTHER KEY FOR NEXT FILE  "
592 A$ = INPUT$(1): CLOSE #2
594 IF A$ = CHR$(27) THEN END ELSE GOTO 10
630 'CHECK FOR PRINTER TIMEOUT
640 IF ERR = 24 AND ERL = 570 THEN RESUME 580 ELSE IF ERR = 24 THEN RESUME
650 IF ERR = 27 THEN PRINT: PRINT "TURN PRINTER ON" : PRINT "PRESS ANY KEY WHEN READY": A$ = INPUT$(1): RESUME
660 ON ERROR GOTO 0: RESUME
670 REM FULL PAGE
680 IF (DSKPRINTER = TRUE) AND (SKIP = TRUE) THEN LPRINT CHR$(12)
690 NOPRTLINES = 0
700 RETURN 370
710 REM DISP FULL
720 WHILE PRTPAUSE = TRUE
730 LOCATE 25,1,0
740 PRINT "PRESS (ESC) TO QUIT, OR (SPACE BAR)";
750 A$ = INPUT$(1)
760 CLS
770 NODISPLINES = 0
780 IF A$ = CHR$(27) THEN CLOSE #2: RETURN 560
790 RETURN 370
800 WEND
810 RETURN 370
820 REM
